<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let myArr=[1, '2', 3, 4, 2, 3, NaN, NaN, undefined, undefined, {}, {}, [], [] ];
        let s = new Set([1, '2', 3, 4, 2, 3, NaN, NaN, undefined, undefined, {}, {}, [], []])
        s.add(456)
        console.log(s);
function myUnique(params) {
    return Array.from(new Set(params))  //强制转换为数组
}

//简写:
console.log([...new Set(myArr)]);

        //es5去重
        
        function unique(arr) {
            for (let i = 0; i < arr.length; i++) {
                for (let j = i + 1; j < arr.length; j++) {
                    if (arr[i] == arr[j]) {
                        arr.splice(j, 1);
                        j--;
                    }
                }
            }
            return arr
        }
console.log(unique(myArr));
    </script>
</body>

</html>